package com.thb.pay.payment.controller;


import com.thb.pay.api.payment.ChannelConfigServiceApi;
import com.thb.pay.api.payment.vo.req.ChannelConfigPageReq;
import com.thb.pay.api.payment.vo.req.ChannelConfigReq;
import com.thb.pay.api.payment.vo.resp.ChannelConfigVo;
import com.thb.pay.core.utils.PageResult;
import com.thb.pay.payment.service.ChannelConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 渠道配置信息表 前端控制器
 * </p>
 *
 * @author lucky
 * @since 2019-07-21
 */
@RestController
public class ChannelConfigController implements ChannelConfigServiceApi {

    @Autowired
    private ChannelConfigService channelConfigService;

    @Override
    public PageResult<ChannelConfigVo> findPage(@RequestBody ChannelConfigPageReq pageReq) {
        return channelConfigService.findPage(pageReq);
    }

    @Override
    public ChannelConfigVo getById(@RequestParam("id") Long id) {
        return channelConfigService.getById(id);
    }

    @Override
    public ChannelConfigVo getByCode(@RequestParam("code") String code) {
        return channelConfigService.getByChannelCode(code);
    }

    @Override
    public void add(@RequestBody ChannelConfigReq channelConfigReq) {
        channelConfigService.add(channelConfigReq);
    }

    @Override
    public void update(@RequestBody ChannelConfigReq channelConfigReq) {
        channelConfigService.update(channelConfigReq);
    }
}
